package router

import (
	"phys-mgr-sys/handlers"

	"github.com/gin-gonic/gin"
)

func Router() *gin.Engine {
	// 1.创建路由
	r := gin.Default()
	// 2.绑定路由规则，执行的函数
	// gin.Context，封装了request和response
	r.GET("/")
	r.POST("/login", handlers.Login)
	r.POST("/roleNodeAdd", handlers.RoleNodeAdd)
	r.POST("/userRoleAdd", handlers.UserRoleAdd)
	r.GET("/userRoleList", handlers.UserRoleList)
	r.GET("/roleNodeList", handlers.RoleNodeList)

	r.POST("/warehouseAdd", handlers.WarehouseAdd)
	r.POST("/warehouseOrderAdd", handlers.WarehouseOrderAdd)
	r.GET("/warehouseOrderList", handlers.WarehouseOrderList)
	r.GET("/warehouseOrderDetail", handlers.WarehouseOrderDetail)

	return r
}
